import request from '@/utils/request.js'

/**
 * 获取菜单树
 * @param searchParams
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export function getMenuTree(searchParams) {
  return request.get('menu/tree', {
    params: {
      menuName: searchParams?.menuName,
      status: searchParams?.status
    }
  })
}

/**
 * 添加菜单
 * @param addForm
 */
export function addMenu(addForm) {
  return request.post('/menu/add', addForm)
}

/**
 * 编辑菜单
 * @param addForm
 */
export function editMenu(addForm) {
  return request.put('/menu/edit', addForm)
}

/**
 * 删除菜单
 * @param id
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export function deleteMenu(id) {
  return request.delete(`/menu/remove/${id}`)
}
